<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>ViewIssue</title>

<%@include file="editheader.jsp"%>


<script type="text/javascript" charset="utf-8">

function EditPageInit(issueid, role) {

	$
			.ajax({
				type : "post",
				url : "../GetIssueDetail",
				datatype : "json",
				data : "issueid=" + issueid,
				success : function(data) {
					if (data.issuedetails.length > 0) {
						//alert("issuedetails: " +
						 // data.issuedetails[0].issuedetails);
						$("#issuetitle").val(data.issuedetails[0].issuetitle);
						//$("#issuedetail").html(data.issuedetails[0].issuedetails);
						CKEDITOR.instances.issuedetails.setData(data.issuedetails[0].issuedetails);
							
						
						if (data.issuedetails[0].category.length > 0) {
							$("#category").val(data.issuedetails[0].category);
							$("#category").trigger("liszt:updated");
						}
						if (data.issuedetails[0].subcategory.length > 0) {
							$("#subcategory").val(
									data.issuedetails[0].subcategory);
						$("#subcategory").trigger("liszt:updated");
						}

						if (data.issuedetails[0].version.length > 0) {
							//$("#version").val(data.issuedetails[0].version);
						}
						
						if (data.issuedetails[0].bugid.length > 0) {
							$("#bugid").val(data.issuedetails[0].bugid);
						} else {
							$("#bugid").val("N.A.");
						}

						

					}

				},
				error : function(jqXHR, textStatus) {
					alert("Error viewing article: " + textStatus);
				}
			});

};


$(document).ready(function() {
var city = "Thanjavur";
//var value = $("#favCities1 option:contains("+city+")").attr('selected', 'selected');
$("#favCities1").val(city);
$("#favCities1").trigger("liszt:updated");
	
$("#favCities1").chosen();



		});
</script>


</head>
<body
	onload="EditPageInit(<%=request.getParameter("issueid")%>, <%=session.getAttribute("userrole")%>)">

	<%@include file="toppanel.jsp"%>

	<input type="hidden" id="articleid" name="articleid"
		value="<%=request.getParameter("articleid")%>">

	<div style="width: 85%; padding-left: 8%">
		<div>
			<br /> Title: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input
				type="text" id="issuetitle" class="span8" name="issuetitle"
				size="150"
				style="padding-left: 3px; padding-top: 3px; padding-bottom: 3px" />

			<em>&nbsp;&nbsp; &nbsp; &nbsp; Bugid:</em> &nbsp;<input class="span2"
				type="text" style="width: 100px;" tabindex="4" id="bugid">

			<div class="side-by-side clearfix" style="padding-top: 20px;">

				<em>Module: &nbsp;</em> <select id="module" class="chzn-select"
					style="width: 200px;" tabindex="2">

				</select> <select id="category" class="chzn-select" style="width: 200px;"
					tabindex="2">

				</select> <select id="subcategory" class="chzn-select" style="width: 200px;"
					tabindex="2">

				</select> <em>&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; Version:&nbsp;</em> <select
					class="chzn-select" id="version" multiple style="width: 350px;"
					tabindex="4">
					<!-- 	<option value=""></option>
						<option value="9.0">9.0</option>
						<option value="9.0.130">9.0.130</option>  -->
				</select>


				<div>
					<select data-placeholder="Choose a Country..." class="chzn-select"
						style="width: 350px;" id="favCities1">
						<option value="Chennai">Chennai</option>
						<option value="Dharmapuri">Dharmapuri</option>
						<option value="Tiruchirappalli">Tiruchirappalli</option>
						<option value="Thanjavur">Thanjavur</option>
						<option value="Bangalore">Bangalore</option>
					</select>
				</div>


			</div>
			<br /> <br />
			<textarea id="issuedetails" rows="30" cols="83"
				style="font-size: 14px; background-color: #f9f9f9;"></textarea>
			<br /> <input type="submit" id="addissuebtnsave" value="save"
				name="btnsave" class="btn" /> &nbsp;&nbsp;&nbsp; <input
				type="submit" id="btncancel" value="cancel" name="btncancel"
				class="btn" />
		</div>



	</div>



	<script src="chosen/chosen.jquery.js" type="text/javascript"></script>
	<script type="text/javascript">
			var config = {
				'.chzn-select' : {},
				'.chzn-select-deselect' : {
					allow_single_deselect : true
				},
				'.chzn-select-no-single' : {
					disable_search_threshold : 10
				},
				'.chzn-select-no-results' : {
					no_results_text : 'Oops, nothing found!'
				},
				'.chzn-select-width' : {
					width : "95%"
				}
			};
			for ( var selector in config) {
				$(selector).chosen(config[selector]);
			}
		</script>



	<script type="text/javascript">
			CKEDITOR
					.replace(
							'issuedetails',
							{
								filebrowserBrowseUrl : '/ckfinder/ckfinder.html',
								filebrowserImageBrowseUrl : '/ckfinder/ckfinder.html?type=Images',
								filebrowserFlashBrowseUrl : '/ckfinder/ckfinder.html?type=Flash',
								filebrowserUploadUrl : 'uploadfileservlet?module=KB',
								filebrowserImageUploadUrl : '/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Images',
								filebrowserFlashUploadUrl : '/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Flash'
							});

			$('.dropdown-toggle').dropdown();
		</script>
</body>
</html>